import com.itheima.dao.OrderSettingDao;
import com.itheima.pojo.OrderSetting;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class POIdemo {
    @Test
    public void test() throws IOException {

        XSSFWorkbook sheets = new XSSFWorkbook("C:\\Users\\huahua\\Desktop\\ordersetting_template.xlsx");
        XSSFSheet sheet = sheets.getSheetAt(0);
        int lastRowNum = sheet.getLastRowNum();
        List<OrderSetting> orderSettingList=new ArrayList<>();
        for (int i=1;i<lastRowNum;i++){
            OrderSetting orderSetting = new OrderSetting();
            Date orderDate = sheet.getRow(i).getCell(0).getDateCellValue();
            int number=(int)sheet.getRow(i).getCell(1).getNumericCellValue();
            orderSetting.setOrderDate(orderDate);
            orderSetting.setNumber(number);
            orderSettingList.add(orderSetting);

        }


    }
}
